﻿using KingsSharp.Common.Data;
using KingsSharp.Core;
using CRM.Admin.Contracts.Dto.Sys;
using CRM.Admin.Contracts.Model.Sys;
using System;
using System.Linq;
using System.Collections.Generic;

namespace CRM.Admin.Contracts.Contract.Sys
{
    /// <summary>
    /// 用户业务接口
    /// </summary>
    public interface IUserInfoService : IDependency
    {
        /// <summary>
        /// 用户集合
        /// </summary>
        IQueryable<UserInfo> ItemUserInfo { get; }

        /// <summary>
        /// 新增用户
        /// </summary>
        /// <param name="dtos">用户信息dto</param>
        /// <returns></returns>
        OperationResult InsertUserInfo(params UserInfoDto[] dtos);

        /// <summary>
        /// 编辑用户
        /// </summary>
        /// <param name="dtos">用户信息dto</param>
        /// <returns></returns>
        OperationResult UpdateUserInfo(params UserInfoDto[] dtos);
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        OperationResult UpdateUserPwd(UserInfo user);

        OperationResult UpdateLastLoginData(UserInfoDto dto);
        /// <summary>
        /// 删除指定用户
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        OperationResult DeleteUserInfo(params Guid[] ids);
        /// <summary>
        /// 获取用户权限
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        List<Guid> GetUserMenuCatalogs(Guid userid);
        /// <summary>
        /// 判断用户是否具有某个页面的按钮权限
        /// </summary>
        /// <param name="actionName">视图action名称</param>
        /// <param name="controllerName">控制器</param>
        /// <param name="operaName">操作名称</param>
        /// <param name="userId">用户id</param>
        /// <returns></returns>
        bool GetUserForPageGarent(string actionName, string controllerName, string operaName, Guid userId);
    }
}
